/**
import { Comments } from '@/components/Comments';
 * Created by Administrator on 2018/11/3.
 */
const Comments = require("../models/comments");
const Company = require("../models/companies");
/**
 * 增加公司信息
 */

module.exports = function (data, req, response) {

  Company.findOne({
    _id: data.recv
  }).then(function (res) {
    const comments = new Comments({
      send: req.cookies.username,
      recv: res.name,
      job: data.job,
      name: data.name,
      phone: data.phone,
      email: data.email,
      comments: data.comments
    });
    comments.save(function (err, res) {
      if (err) {
        console.log(err);
      }
      response.json({
        status: 0,
        data: {
          msg: '留言成功!'
        }
      })
    })
  })

}
